package com.xiaomaoguai.observer.jdk;

import java.util.Observable;
import java.util.Observer;

/**
 * @ FileName: Watcher.java
 * @ Author: WeiHui-Z
 * @ Date: 2017/4/25 15:04
 * @ Version: v1.0.0
 */
public class Watcher implements Observer {

    public Watcher(Observable o) {
        o.addObserver(this);
    }

    @Override
    public void update(Observable o, Object arg) {
        System.out.println("状态发生改变：" + ((Watched) o).getData());
    }

}
